<html>
<head><meta charset="utf-8"><title>Unifying cg_llvm and cg_clif · project-portable-simd · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/index.html">project-portable-simd</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unifying.20cg_llvm.20and.20cg_clif.html">Unifying cg_llvm and cg_clif</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="235537429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unifying%20cg_llvm%20and%20cg_clif/near/235537429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unifying.20cg_llvm.20and.20cg_clif.html#235537429">(Apr 21 2021 at 16:06)</a>:</h4>
<p>So, we made an MCP that has been seconded where we basically are on point to restructure SIMD codegen. <br>
Because <span aria-label="musical notes" class="emoji emoji-1f3b6" role="img" title="musical notes">:musical_notes:</span> I love doing more work! <span aria-label="musical notes" class="emoji emoji-1f3b6" role="img" title="musical notes">:musical_notes:</span> <br>
<a href="https://github.com/rust-lang/compiler-team/issues/381">https://github.com/rust-lang/compiler-team/issues/381</a></p>
<p>Right now, <code>rustc_codegen_llvm</code> is where most of the "platform intrinsics" are functionally defined: their names also appear elsewhere but the entire implementation is really in <code>cg_llvm</code>. Right now, however, rustc supports <code>rustc_codegen_ssa</code>, which afaict is basically the pile of backend-agnostic middleware, and so will be our main interface point to any codegen backend.</p>
<p>The draft of the MCP describes roughly what we're about to do. We have already made some tweaks to <code>cg_llvm</code> because we have been having overly Interesting results from codegen, but this will probably wind up refactoring it a lot more.</p>



<a name="235542943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unifying%20cg_llvm%20and%20cg_clif/near/235542943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unifying.20cg_llvm.20and.20cg_clif.html#235542943">(Apr 21 2021 at 16:41)</a>:</h4>
<blockquote>
<ul>
<li>Set an expectation that <code>simd_*</code> intrinsics from <code>extern "platform-intrinsic"</code> will form the basis of backend-agnostic intrinsics within the standard library.</li>
<li>Fill in any missing gaps in existing <code>simd_*</code> intrinsics so that <code>core::simd</code> can avoid any direct LLVM dependency.</li>
<li>Provide non-vectorized reference implementations for all <code>simd_*</code> intrinsics that are exposed through <code>compiler_builtins</code>.</li>
</ul>
</blockquote>



<a name="235543152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Unifying%20cg_llvm%20and%20cg_clif/near/235543152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Unifying.20cg_llvm.20and.20cg_clif.html#235543152">(Apr 21 2021 at 16:43)</a>:</h4>
<p>For platform intrinsics, <code>cg_llvm</code> partly uses methods that <code>cg_ssa</code> already requires a backend to implement (which incidentally aligns to what uses a C++ wrapper) but exploiting the fact that all of them are overloaded for SIMD in LLVM, and partly emits LLVM IR directly.</p>
<p><code>cg_clif</code> has a partial implementation of most of our "platform intrinsics", so we already have some points of comparison for those.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>